/*     */ package com.zimbra.cs.redolog.op;
/*     */ 
/*     */ import com.google.common.base.Objects;
/*     */ import com.google.common.base.Objects.ToStringHelper;
/*     */ import com.zimbra.cs.mailbox.MailboxOperation;
/*     */ import com.zimbra.cs.redolog.RedoLogInput;
/*     */ import com.zimbra.cs.redolog.RedoLogOutput;
/*     */ import com.zimbra.cs.volume.Volume;
/*     */ import com.zimbra.cs.volume.Volume.Builder;
/*     */ import com.zimbra.cs.volume.VolumeManager;
/*     */ import java.io.IOException;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public final class ModifyVolume
/*     */   extends RedoableOp
/*     */ {
/*     */   private short id;
/*     */   private short type;
/*     */   private String name;
/*     */   private String rootPath;
/*     */   private short mboxGroupBits;
/*     */   private short mboxBits;
/*     */   private short fileGroupBits;
/*     */   private short fileBits;
/*     */   private boolean compressBlobs;
/*     */   private long compressionThreshold;
/*     */   
/*     */   public ModifyVolume()
/*     */   {
/*  45 */     super(MailboxOperation.ModifyVolume);
/*     */   }
/*     */   
/*     */   public ModifyVolume(Volume volume) {
/*  49 */     this();
/*  50 */     this.id = volume.getId();
/*  51 */     this.type = volume.getType();
/*  52 */     this.name = volume.getName();
/*  53 */     this.rootPath = volume.getRootPath();
/*     */     
/*  55 */     this.mboxGroupBits = volume.getMboxGroupBits();
/*  56 */     this.mboxBits = volume.getMboxBits();
/*  57 */     this.fileGroupBits = volume.getFileGroupBits();
/*  58 */     this.fileBits = volume.getFileBits();
/*     */     
/*  60 */     this.compressBlobs = volume.isCompressBlobs();
/*  61 */     this.compressionThreshold = volume.getCompressionThreshold();
/*     */   }
/*     */   
/*     */   protected String getPrintableData()
/*     */   {
/*  66 */     return Objects.toStringHelper(this).add("id", this.id).add("type", this.type).add("name", this.name).add("path", this.rootPath).add("mboxGroupBits", this.mboxGroupBits).add("mboxBits", this.mboxBits).add("fileGroupBits", this.fileGroupBits).add("fileBits", this.fileBits).add("compressBlobs", this.compressBlobs).add("compressionThrehold", this.compressionThreshold).toString();
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */   protected void serializeData(RedoLogOutput out)
/*     */     throws IOException
/*     */   {
/*  75 */     out.writeShort(this.id);
/*  76 */     out.writeShort(this.type);
/*  77 */     out.writeUTF(this.name);
/*  78 */     out.writeUTF(this.rootPath);
/*  79 */     out.writeShort(this.mboxGroupBits);
/*  80 */     out.writeShort(this.mboxBits);
/*  81 */     out.writeShort(this.fileGroupBits);
/*  82 */     out.writeShort(this.fileBits);
/*     */   }
/*     */   
/*     */   protected void deserializeData(RedoLogInput in) throws IOException
/*     */   {
/*  87 */     this.id = in.readShort();
/*  88 */     this.type = in.readShort();
/*  89 */     this.name = in.readUTF();
/*  90 */     this.rootPath = in.readUTF();
/*  91 */     this.mboxGroupBits = in.readShort();
/*  92 */     this.mboxBits = in.readShort();
/*  93 */     this.fileGroupBits = in.readShort();
/*  94 */     this.fileBits = in.readShort();
/*     */   }
/*     */   
/*     */   public void redo() throws Exception
/*     */   {
/*  99 */     VolumeManager mgr = VolumeManager.getInstance();
/* 100 */     mgr.getVolume(this.id);
/* 101 */     Volume vol = Volume.builder().setId(this.id).setType(this.type).setName(this.name).setPath(this.rootPath, false).setMboxGroupBits(this.mboxGroupBits).setMboxBit(this.mboxBits).setFileGroupBits(this.fileGroupBits).setFileBits(this.fileBits).setCompressBlobs(this.compressBlobs).setCompressionThreshold(this.compressionThreshold).build();
/*     */     
/*     */ 
/*     */ 
/* 105 */     mgr.update(vol, getUnloggedReplay());
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/redolog/op/ModifyVolume.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */